From: Keir Fraser Date: Mon, 1 Jun 2009 13:12:53 +0000 (+0100) Subject: libxc: export xc_map_m2p() so that it can be called outside. X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~13838 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success//%22http:/www.example.com/cgi/success/?a=commitdiff_plain;h=602097e84bfe3481d12d6de7a257005a1aa51b89;p=xen.git libxc: export xc_map_m2p() so that it can be called outside. Signed-off-by: Jiang, Yunhong --- diff --git a/tools/libxc/xc_domain_save.c b/tools/libxc/xc_domain_save.c index 04d4b3085c..90557e26cf 100644 --- a/tools/libxc/xc_domain_save.c +++ b/tools/libxc/xc_domain_save.c @@ -510,9 +510,10 @@ static int canonicalize_pagetable(unsigned long type, unsigned long pfn, return race; } -static xen_pfn_t *xc_map_m2p(int xc_handle, +xen_pfn_t *xc_map_m2p(int xc_handle, unsigned long max_mfn, - int prot) + int prot, + unsigned long *mfn0) { struct xen_machphys_mfn_list xmml; privcmd_mmap_entry_t *entries; @@ -561,7 +562,8 @@ static xen_pfn_t *xc_map_m2p(int xc_handle, goto err2; } - m2p_mfn0 = entries[0].mfn; + if (mfn0) + *mfn0 = entries[0].mfn; err2: free(entries); @@ -949,7 +951,7 @@ int xc_domain_save(int xc_handle, int io_fd, uint32_t dom, uint32_t max_iters, } /* Setup the mfn_to_pfn table mapping */ - if ( !(live_m2p = xc_map_m2p(xc_handle, max_mfn, PROT_READ)) ) + if ( !(live_m2p = xc_map_m2p(xc_handle, max_mfn, PROT_READ, &m2p_mfn0)) ) { ERROR("Failed to map live M2P table"); goto out; diff --git a/tools/libxc/xenguest.h b/tools/libxc/xenguest.h index 32de5bdd93..cd55f89cca 100644 --- a/tools/libxc/xenguest.h +++ b/tools/libxc/xenguest.h @@ -163,4 +163,17 @@ int xc_mark_page_offline(int xc, unsigned long start, int xc_query_page_offline_status(int xc, unsigned long start, unsigned long end, uint32_t *status); + +/** + * This function map m2p table + * @parm xc_handle a handle to an open hypervisor interface + * @parm max_mfn the max pfn + * @parm prot the flags to map, such as read/write etc + * @parm mfn0 return the first mfn, can be NULL + * @return mapped m2p table on success, NULL on failure + */ +xen_pfn_t *xc_map_m2p(int xc_handle, + unsigned long max_mfn, + int prot, + unsigned long *mfn0); #endif /* XENGUEST_H */